home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / compress / unz530x3.zip / UNZIP.DOC < prev    next >
Text File  |  1997-04-22  |  46KB  |  910 lines

  1.  
  2. UNZIP(1L)                                               UNZIP(1L)
  3.  
  4. NAME
  5.        unzip  -  list, test and extract compressed files in a ZIP
  6.        archive
  7.  
  8. SYNOPSIS
  9.        unzip    [-Z]    [-cflptuvz[abjnoqsCLMVX$]]     file[.zip]
  10.        [file(s) ...]  [-x xfile(s) ...] [-d exdir]
  11.  
  12. DESCRIPTION
  13.        unzip  will  list,  test,  or  extract  files  from  a ZIP
  14.        archive, commonly found on MS-DOS  systems.   The  default
  15.        behavior  (with no options) is to extract into the current
  16.        directory (and subdirectories below it) all files from the
  17.        specified ZIP archive.  A companion program, zip(1L), cre-
  18.        ates ZIP  archives;  both  programs  are  compatible  with
  19.        archives created by PKWARE's PKZIP and PKUNZIP for MS-DOS,
  20.        but in many cases the program options or default behaviors
  21.        differ.
  22.  
  23. ARGUMENTS
  24.        file[.zip]
  25.               Path of the ZIP archive(s).  If the file specifica-
  26.               tion is a wildcard, each matching file is processed
  27.               in  an order determined by the operating system (or
  28.               file system).  Only the filename can be a wildcard;
  29.               the  path  itself cannot.  Wildcard expressions are
  30.               similar to Unix egrep(1) (regular) expressions  and
  31.               may contain:
  32.  
  33.               *      matches a sequence of 0 or more characters
  34.  
  35.               ?      matches exactly 1 character
  36.  
  37.               [...]  matches  any  single  character found inside
  38.                      the brackets;  ranges  are  specified  by  a
  39.                      beginning character, a hyphen, and an ending
  40.                      character.  If an  exclamation  point  or  a
  41.                      caret (`!' or `^') follows the left bracket,
  42.                      then the  range  of  characters  within  the
  43.                      brackets  is complemented (that is, anything
  44.                      except the characters inside the brackets is
  45.                      considered a match).
  46.  
  47.               (Be  sure  to quote any character that might other-
  48.               wise be interpreted or modified  by  the  operating
  49.               system,  particularly  under  Unix and VMS.)  If no
  50.               matches are found, the specification is assumed  to
  51.               be  a literal filename; and if that also fails, the
  52.               suffix .zip is appended.  Note that self-extracting
  53.               ZIP  files  are  supported,  as  with any other ZIP
  54.               archive; just specify  the  .exe  suffix  (if  any)
  55.               explicitly.
  56.  
  57. Info-ZIP               22 April 1997 (v5.3)                     1
  58.  
  59. UNZIP(1L)                                               UNZIP(1L)
  60.  
  61.        [file(s)]
  62.               An  optional  list  of  archive  members to be pro-
  63.               cessed, separated by spaces.   (VMS  versions  com-
  64.               piled  with  VMSCLI defined must delimit files with
  65.               commas instead.  See -v in OPTIONS below.)  Regular
  66.               expressions (wildcards) may be used to match multi-
  67.               ple members; see above.  Again, be  sure  to  quote
  68.               expressions  that  would  otherwise  be expanded or
  69.               modified by the operating system.
  70.  
  71.        [-x xfile(s)]
  72.               An optional list of archive members to be  excluded
  73.               from  processing.   Since wildcard characters match
  74.               directory separators (`/'), this option may be used
  75.               to  exclude  any  files that are in subdirectories.
  76.               For example, ``unzip  foo  *.[ch]  -x  */*''  would
  77.               extract  all  C source files in the main directory,
  78.               but none in any  subdirectories.   Without  the  -x
  79.               option,  all  C  source  files  in  all directories
  80.               within the zipfile would be extracted.
  81.  
  82.        [-d exdir]
  83.               An optional directory to which  to  extract  files.
  84.               By default, all files and subdirectories are recre-
  85.               ated in the current directory; the -d option allows
  86.               extraction in an arbitrary directory (always assum-
  87.               ing one has permission to write to the  directory).
  88.               This  option need not appear at the end of the com-
  89.               mand line; it is also accepted before  the  zipfile
  90.               specification  (with  the  normal options), immedi-
  91.               ately after the zipfile specification,  or  between
  92.               the  file(s)  and  the  -x  option.  The option and
  93.               directory may be  concatenated  without  any  white
  94.               space  between  them,  but note that this may cause
  95.               normal shell behavior to be suppressed.  In partic-
  96.               ular, ``-d ~'' (tilde) is expanded by Unix C shells
  97.               into the name of the  user's  home  directory,  but
  98.               ``-d~''  is treated as a literal subdirectory ``~''
  99.               of the current directory.
  100.  
  101. OPTIONS
  102.        Note that,  in  order  to  support  obsolescent  hardware,
  103.        unzip's  usage  screen  is  limited  to 22 or 23 lines and
  104.        should therefore be considered  only  a  reminder  of  the
  105.        basic  unzip  syntax rather than an exhaustive list of all
  106.        possible flags.  The exhaustive list follows:
  107.  
  108.        -Z     zipinfo(1L) mode.  If the first option on the  com-
  109.               mand line is -Z, the remaining options are taken to
  110.               be zipinfo(1L) options.  See the appropriate manual
  111.               page for a description of these options.
  112.  
  113.        -A     [OS/2,  Unix DLL] print extended help for the DLL's
  114.               programming interface (API).
  115.  
  116. Info-ZIP               22 April 1997 (v5.3)                     2
  117.  
  118. UNZIP(1L)                                               UNZIP(1L)
  119.  
  120.        -c     extract files  to  stdout/screen  (``CRT'').   This
  121.               option  is similar to the -p option except that the
  122.               name of each file is printed as  it  is  extracted,
  123.               the  -a option is allowed, and ASCII-EBCDIC conver-
  124.               sion is  automatically  performed  if  appropriate.
  125.               This  option  is  not  listed  in  the  unzip usage
  126.               screen.
  127.  
  128.        -f     freshen existing files, i.e.,  extract  only  those
  129.               files that already exist on disk and that are newer
  130.               than the disk copies.   By  default  unzip  queries
  131.               before  overwriting,  but the -o option may be used
  132.               to suppress the  queries.   Note  that  under  many
  133.               operating  systems,  the  TZ (timezone) environment
  134.               variable must be set correctly in order for -f  and
  135.               -u  to  work  properly  (under Unix the variable is
  136.               usually set automatically).  The reasons  for  this
  137.               are somewhat subtle but have to do with the differ-
  138.               ences between DOS-format file times  (always  local
  139.               time) and Unix-format times (always in GMT/UTC) and
  140.               the necessity to compare the  two.   A  typical  TZ
  141.               value  is  ``PST8PDT''  (US Pacific time with auto-
  142.               matic  adjustment  for  Daylight  Savings  Time  or
  143.               ``summer time'').
  144.  
  145.        -l     list  archive  files  (short  format).   The names,
  146.               uncompressed file sizes and modification dates  and
  147.               times  of  the  specified  files are printed, along
  148.               with totals for all files specified.  If UnZip  was
  149.               compiled  with  OS2_EAS defined, the -l option also
  150.               lists columns for the sizes of stored OS/2 extended
  151.               attributes  (EAs)  and  OS/2  access  control lists
  152.               (ACLs).  In addition, the zipfile comment and indi-
  153.               vidual  file comments (if any) are displayed.  If a
  154.               file was archived from a  single-case  file  system
  155.               (for  example,  the old MS-DOS FAT file system) and
  156.               the -L option was given, the filename is  converted
  157.               to lowercase and is prefixed with a caret (^).
  158.  
  159.        -p     extract  files  to  pipe (stdout).  Nothing but the
  160.               file data is sent to  stdout,  and  the  files  are
  161.               always extracted in binary format, just as they are
  162.               stored (no conversions).
  163.  
  164.        -t     test archive  files.   This  option  extracts  each
  165.               specified  file  in  memory  and  compares  the CRC
  166.               (cyclic redundancy check, an enhanced checksum)  of
  167.               the  expanded  file with the original file's stored
  168.               CRC value.
  169.  
  170.        -T     [Unix only, and only  if  compiled  with  TIMESTAMP
  171.               defined]  set  the  timestamp  on the archive(s) to
  172.               that of the newest file in each one.   This  corre-
  173.               sponds  to  zip's  -go option except that it can be
  174.  
  175. Info-ZIP               22 April 1997 (v5.3)                     3
  176.  
  177. UNZIP(1L)                                               UNZIP(1L)
  178.  
  179.               used  on  wildcard  zipfiles  (e.g.,   ``unzip   -T
  180.               \*.zip'') and is much faster.
  181.  
  182.        -u     update  existing  files  and  create  new  ones  if
  183.               needed.  This option performs the same function  as
  184.               the  -f  option, extracting (with query) files that
  185.               are newer than those with the same  name  on  disk,
  186.               and in addition it extracts those files that do not
  187.               already exist on disk.  See -f above  for  informa-
  188.               tion on setting the timezone properly.
  189.  
  190.        -v     be  verbose or print diagnostic version info.  This
  191.               option has evolved  and  now  behaves  as  both  an
  192.               option  and  a  modifier.   As an option it has two
  193.               purposes:  when a  zipfile  is  specified  with  no
  194.               other  options,  -v  lists archive files verbosely,
  195.               adding to the basic -l info the compression method,
  196.               compressed  size, compression ratio and 32-bit CRC.
  197.               When no zipfile is specified (that is, the complete
  198.               command  is  simply  ``unzip  -v''),  a  diagnostic
  199.               screen is  printed.   In  addition  to  the  normal
  200.               header  with  release date and version, unzip lists
  201.               the home Info-ZIP ftp site and where to find a list
  202.               of  other ftp and non-ftp sites; the target operat-
  203.               ing system for which it was compiled,  as  well  as
  204.               (possibly)  the  hardware on which it was compiled,
  205.               the compiler and version used, and the  compilation
  206.               date;  any  special  compilation options that might
  207.               affect the program's operation (see also DECRYPTION
  208.               below); and any options stored in environment vari-
  209.               ables that  might  do  the  same  (see  ENVIRONMENT
  210.               OPTIONS below).  As a modifier it works in conjunc-
  211.               tion with other options (e.g., -t) to produce  more
  212.               verbose  or debugging output; this is not yet fully
  213.               implemented but will be in future releases.
  214.  
  215.        -z     display only the archive comment.
  216.  
  217. MODIFIERS
  218.        -a     convert  text  files.   Ordinarily  all  files  are
  219.               extracted exactly as they are stored (as ``binary''
  220.               files).  The -a option causes files  identified  by
  221.               zip as text files (those with the `t' label in zip-
  222.               info listings, rather than `b') to be automatically
  223.               extracted as such, converting line endings, end-of-
  224.               file characters and the  character  set  itself  as
  225.               necessary.  (For example, Unix files use line feeds
  226.               (LFs) for end-of-line (EOL) and have no end-of-file
  227.               (EOF)  marker;  Macintoshes  use  carriage  returns
  228.               (CRs) for EOLs; and most PC operating  systems  use
  229.               CR+LF for EOLs and control-Z for EOF.  In addition,
  230.               IBM mainframes and the Michigan Terminal System use
  231.               EBCDIC  rather than the more common ASCII character
  232.               set, and NT supports  Unicode.)   Note  that  zip's
  233.  
  234. Info-ZIP               22 April 1997 (v5.3)                     4
  235.  
  236. UNZIP(1L)                                               UNZIP(1L)
  237.  
  238.               identification  of  text  files is by no means per-
  239.               fect; some ``text'' files may  actually  be  binary
  240.               and  vice versa.  unzip therefore prints ``[text]''
  241.               or ``[binary]'' as a visual check for each file  it
  242.               extracts  when using the -a option.  The -aa option
  243.               forces all files to be extracted as  text,  regard-
  244.               less of the supposed file type.
  245.  
  246.        -b     [non-VMS]  treat  all files as binary (no text con-
  247.               versions).  This is a shortcut for ---a.
  248.  
  249.        -b     [VMS] auto-convert binary files (see -a  above)  to
  250.               fixed-length, 512-byte record format.  Doubling the
  251.               option (-bb) forces all files to  be  extracted  in
  252.               this format.
  253.  
  254.        -B     [Unix  only,  and  only if compiled with UNIXBACKUP
  255.               defined] save a backup  copy  of  each  overwritten
  256.               file  with  a tilde appended (e.g., the old copy of
  257.               ``foo'' is renamed to ``foo~'').  This  is  similar
  258.               to  the  default behavior of emacs(1) in many loca-
  259.               tions.
  260.  
  261.        -C     match filenames case-insensitively.   unzip's  phi-
  262.               losophy  is  ``you  get what you ask for'' (this is
  263.               also responsible for the -L/-U change; see the rel-
  264.               evant  options  below).   Because some file systems
  265.               are fully case-sensitive (notably those  under  the
  266.               Unix   operating   system)  and  because  both  ZIP
  267.               archives and unzip itself are portable across plat-
  268.               forms,  unzip's  default  behavior is to match both
  269.               wildcard and  literal  filenames  case-sensitively.
  270.               That  is,  specifying  ``makefile''  on the command
  271.               line will only match ``makefile'' in  the  archive,
  272.               not ``Makefile'' or ``MAKEFILE'' (and similarly for
  273.               wildcard specifications).  Since this does not cor-
  274.               respond  to  the  behavior  of  many  other operat-
  275.               ing/file systems (for  example,  OS/2  HPFS,  which
  276.               preserves  mixed  case but is not sensitive to it),
  277.               the -C option may be used  to  force  all  filename
  278.               matches  to  be  case-insensitive.   In the example
  279.               above, all three files  would  then  match  ``make-
  280.               file''  (or  ``make*'', or similar).  The -C option
  281.               affects files in both the normal file list and  the
  282.               excluded-file list (xlist).
  283.  
  284.        -j     junk  paths.   The archive's directory structure is
  285.               not recreated;  all  files  are  deposited  in  the
  286.               extraction directory (by default, the current one).
  287.  
  288.        -L     convert to lowercase any filename originating on an
  289.               uppercase-only  operating  system  or  file system.
  290.               (This was  unzip's  default  behavior  in  releases
  291.               prior   to   5.11;  the  new  default  behavior  is
  292.  
  293. Info-ZIP               22 April 1997 (v5.3)                     5
  294.  
  295. UNZIP(1L)                                               UNZIP(1L)
  296.  
  297.               identical to the old behavior with the  -U  option,
  298.               which  is  now  obsolete  and  will be removed in a
  299.               future release.)  Depending on the archiver,  files
  300.               archived  under  single-case file systems (VMS, old
  301.               MS-DOS FAT, etc.) may be  stored  as  all-uppercase
  302.               names;  this  can  be  ugly  or  inconvenient  when
  303.               extracting to a case-preserving file system such as
  304.               OS/2  HPFS  or  a  case-sensitive one such as under
  305.               Unix.  By default unzip  lists  and  extracts  such
  306.               filenames  exactly  as  they're  stored  (excepting
  307.               truncation, conversion of  unsupported  characters,
  308.               etc.);  this  option  causes the names of all files
  309.               from certain systems to be converted to  lowercase.
  310.  
  311.        -M     pipe  all  output through an internal pager similar
  312.               to the  Unixmore(1)  command.   At  the  end  of  a
  313.               screenful   of   output,   unzip   pauses   with  a
  314.               ``--More--'' prompt;  the  next  screenful  may  be
  315.               viewed  by  pressing  the Enter (Return) key or the
  316.               space bar.  unzip can be terminated by pressing the
  317.               ``q''  key  and,  on some systems, the Enter/Return
  318.               key.  Unlike Unix more(1),  there  is  no  forward-
  319.               searching   or  editing  capability.   Also,  unzip
  320.               doesn't notice if long lines wrap at  the  edge  of
  321.               the  screen,  effectively resulting in the printing
  322.               of two or more lines and the likelihood  that  some
  323.               text  will  scroll off the top of the screen before
  324.               being viewed.  On some systems the number of avail-
  325.               able  lines on the screen is not detected, in which
  326.               case unzip assumes the height is 24 lines.
  327.  
  328.        -n     never overwrite existing files.  If a file  already
  329.               exists,  skip  the  extraction of that file without
  330.               prompting.   By  default   unzip   queries   before
  331.               extracting  any  file that already exists; the user
  332.               may choose to  overwrite  only  the  current  file,
  333.               overwrite all files, skip extraction of the current
  334.               file, skip extraction of  all  existing  files,  or
  335.               rename the current file.
  336.  
  337.        -N     [Amiga]  extract  file comments as Amiga filenotes.
  338.               File comments are created with  the  -c  option  of
  339.               zip(1L), or with the -N option of the Amiga port of
  340.               zip(1L), which stores filenotes as comments.
  341.  
  342.        -o     overwrite existing files without  prompting.   This
  343.               is a dangerous option, so use it with care.  (It is
  344.               often used with -f, however, and is the only way to
  345.               overwrite directory EAs under OS/2.)
  346.  
  347.        -P password
  348.               use  password  to decrypt encrypted zipfile entries
  349.               (if  any).   THIS  IS  INSECURE!   Many  multi-user
  350.  
  351. Info-ZIP               22 April 1997 (v5.3)                     6
  352.  
  353. UNZIP(1L)                                               UNZIP(1L)
  354.  
  355.               operating  systems provide ways for any user to see
  356.               the current command line of any other user; even on
  357.               stand-alone  systems  there is always the threat of
  358.               over-the-shoulder peeking.  Storing  the  plaintext
  359.               password  as part of a command line in an automated
  360.               script is even worse.  Whenever possible,  use  the
  361.               non-echoing, interactive prompt to enter passwords.
  362.               (And where security is truly important, use  strong
  363.               encryption  such  as Pretty Good Privacy instead of
  364.               the relatively weak encryption provided by standard
  365.               zipfile utilities.)
  366.  
  367.        -q     perform  operations  quietly  (-qq = even quieter).
  368.               Ordinarily unzip prints the names of the files it's
  369.               extracting  or testing, the extraction methods, any
  370.               file or zipfile comments that may be stored in  the
  371.               archive,  and possibly a summary when finished with
  372.               each  archive.   The  -q[q]  options  suppress  the
  373.               printing of some or all of these messages.
  374.  
  375.        -s     [OS/2,  NT,  MS-DOS] convert spaces in filenames to
  376.               underscores.  Since all PC operating systems  allow
  377.               spaces  in  filenames,  unzip  by  default extracts
  378.               filenames     with     spaces     intact     (e.g.,
  379.               ``EA DATA. SF'').   This  can  be awkward, however,
  380.               since MS-DOS in particular does not gracefully sup-
  381.               port  spaces in filenames.  Conversion of spaces to
  382.               underscores can eliminate the awkwardness  in  some
  383.               cases.
  384.  
  385.        -U     (obsolete; to be removed in a future release) leave
  386.               filenames uppercase if created under  MS-DOS,  VMS,
  387.               etc.  See -L above.
  388.  
  389.        -V     retain  (VMS)  file version numbers.  VMS files can
  390.               be stored with a  version  number,  in  the  format
  391.               file.ext;##.   By  default the ``;##'' version num-
  392.               bers are stripped, but this option allows  them  to
  393.               be retained.  (On file systems that limit filenames
  394.               to particularly short lengths, the version  numbers
  395.               may  be  truncated  or  stripped regardless of this
  396.               option.)
  397.  
  398.        -X     [VMS, Unix, OS/2, NT] restore owner/protection info
  399.               (UICs)  under VMS, or user and group info (UID/GID)
  400.               under Unix, or access control  lists  (ACLs)  under
  401.               certain  network-enabled  versions  of  OS/2  (Warp
  402.               Server with IBM LAN Server/Requester  3.0  to  5.0;
  403.               Warp  Connect  with IBM Peer 1.0), or security ACLs
  404.               under Windows NT.  In most cases this will  require
  405.               special  system privileges, and doubling the option
  406.               (-XX) under NT instructs unzip  to  use  privileges
  407.               for extraction; but under Unix, for example, a user
  408.               who belongs to several  groups  can  restore  files
  409.  
  410. Info-ZIP               22 April 1997 (v5.3)                     7
  411.  
  412. UNZIP(1L)                                               UNZIP(1L)
  413.  
  414.               owned  by  any of those groups, as long as the user
  415.               IDs match his or her own.  Note that ordinary  file
  416.               attributes are always restored--this option applies
  417.               only to optional, extra ownership info available on
  418.               some operating systems.  [NT's access control lists
  419.               do not appear  to  be  especially  compatible  with
  420.               OS/2's,  so  no  attempt  is made at cross-platform
  421.               portability of access privileges.  It is not  clear
  422.               under  what  conditions  this  would ever be useful
  423.               anyway.]
  424.  
  425.        -$     [MS-DOS, OS/2, NT] restore the volume label if  the
  426.               extraction  medium is removable (e.g., a diskette).
  427.               Doubling the option (-$$) allows fixed media  (hard
  428.               disks)  to be labelled as well.  By default, volume
  429.               labels are ignored.
  430.  
  431. ENVIRONMENT OPTIONS
  432.        unzip's default  behavior  may  be  modified  via  options
  433.        placed  in an environment variable.  This can be done with
  434.        any option, but it is probably most useful  with  the  -a,
  435.        -L,  -C, -q, -o, or -n modifiers:  make unzip auto-convert
  436.        text files by default,  make  it  convert  filenames  from
  437.        uppercase  systems to lowercase, make it match names case-
  438.        insensitively, make it quieter, or make  it  always  over-
  439.        write  or  never overwrite files as it extracts them.  For
  440.        example, to make unzip act as quietly  as  possible,  only
  441.        reporting  errors, one would use one of the following com-
  442.        mands:
  443.  
  444.            UNZIP=-qq; export UNZIP    Unix Bourne shell
  445.            setenv UNZIP -qq           Unix C shell
  446.            set UNZIP=-qq              OS/2 or MS-DOS
  447.            define UNZIP_OPTS "-qq"    VMS (quotes for lowercase)
  448.  
  449.        Environment options are, in effect, considered to be  just
  450.        like  any other command-line options, except that they are
  451.        effectively the first options on  the  command  line.   To
  452.        override  an  environment  option, one may use the ``minus
  453.        operator'' to remove it.  For instance, to override one of
  454.        the quiet-flags in the example above, use the command
  455.  
  456.            unzip --q[other options] zipfile
  457.  
  458.        The  first  hyphen is the normal switch character, and the
  459.        second is a minus sign, acting on the q option.  Thus  the
  460.        effect  here  is  to  cancel one quantum of quietness.  To
  461.        cancel both quiet flags, two  (or  more)  minuses  may  be
  462.        used:
  463.  
  464.            unzip -t--q zipfile
  465.            unzip ---qt zipfile
  466.  
  467.        (the  two  are  equivalent).   This  may  seem  awkward or
  468.  
  469. Info-ZIP               22 April 1997 (v5.3)                     8
  470.  
  471. UNZIP(1L)                                               UNZIP(1L)
  472.  
  473.        confusing, but it is reasonably  intuitive:   just  ignore
  474.        the first hyphen and go from there.  It is also consistent
  475.        with the behavior of Unix nice(1).
  476.  
  477.        As suggested by the examples above, the  default  variable
  478.        names  are  UNZIP_OPTS  for  VMS (where the symbol used to
  479.        install unzip as a foreign command would otherwise be con-
  480.        fused  with  the  environment variable), and UNZIP for all
  481.        other operating systems.  For compatibility with  zip(1L),
  482.        UNZIPOPT  is also accepted (don't ask).  If both UNZIP and
  483.        UNZIPOPT are defined,  however,  UNZIP  takes  precedence.
  484.        unzip's diagnostic option (-v with no zipfile name) can be
  485.        used to check the values of all four  possible  unzip  and
  486.        zipinfo environment variables.
  487.  
  488.        The  timezone variable (TZ) should be set according to the
  489.        local timezone in order for the -f and -u to operate  cor-
  490.        rectly.   See  the  description  of  -f above for details.
  491.        This variable may also be necessary in  order  for  times-
  492.        tamps  on extracted files to be set correctly.  Under Win-
  493.        dows 95/NT unzip should know the correct timezone even  if
  494.        TZ is unset, assuming the timezone is correctly set in the
  495.        Control Panel.
  496.  
  497. DECRYPTION
  498.        Encrypted archives are fully supported by  Info-ZIP  soft-
  499.        ware,  but  due  to United States export restrictions, the
  500.        encryption and decryption sources are  not  packaged  with
  501.        the  regular unzip and zip distributions.  Since the crypt
  502.        sources were  written  by  Europeans,  however,  they  are
  503.        freely  available  at  sites throughout the world; see the
  504.        file ``Where'' in any Info-ZIP source or binary  distribu-
  505.        tion for locations both inside and outside the US.
  506.  
  507.        Because  of  the  separate  distribution, not all compiled
  508.        versions of unzip support decryption.  To check a  version
  509.        for  crypt  support,  either attempt to test or extract an
  510.        encrypted archive, or else check unzip's diagnostic screen
  511.        (see  the  -v option above) for ``[decryption]'' as one of
  512.        the special compilation options.
  513.  
  514.        As noted above, the -P option may  be  used  to  supply  a
  515.        password  on  the command line, but at a cost in security.
  516.        The preferred decryption method is simply to extract  nor-
  517.        mally; if a zipfile member is encrypted, unzip will prompt
  518.        for the password without echoing  what  is  typed.   unzip
  519.        continues  to  use the same password as long as it appears
  520.        to be valid, by testing a 12-byte  header  on  each  file.
  521.        The  correct  password  will  always check out against the
  522.        header, but there is a 1-in-256 chance that  an  incorrect
  523.        password will as well.  (This is a security feature of the
  524.        PKWARE  zipfile  format;  it  helps  prevent   brute-force
  525.        attacks  that might otherwise gain a large speed advantage
  526.        by  testing  only  the  header.)   In  the  case  that  an
  527.  
  528. Info-ZIP               22 April 1997 (v5.3)                     9
  529.  
  530. UNZIP(1L)                                               UNZIP(1L)
  531.  
  532.        incorrect  password is given but it passes the header test
  533.        anyway, either an incorrect CRC will be generated for  the
  534.        extracted  data or else unzip will fail during the extrac-
  535.        tion because the ``decrypted'' bytes do not  constitute  a
  536.        valid compressed data stream.
  537.  
  538.        If the first password fails the header check on some file,
  539.        unzip will prompt for another password, and  so  on  until
  540.        all  files  are  extracted.   If  a password is not known,
  541.        entering a null password (that is, just a carriage  return
  542.        or  ``Enter'')  is  taken  as a signal to skip all further
  543.        prompting.  Only unencrypted files in the archive(s)  will
  544.        thereafter be extracted.  (In fact, that's not quite true;
  545.        older versions of zip(1L) and  zipcloak(1L)  allowed  null
  546.        passwords,  so  unzip checks each encrypted file to see if
  547.        the null password works.  This may result in ``false posi-
  548.        tives'' and extraction errors, as noted above.)
  549.  
  550.        Archives  encrypted  with  8-bit  passwords  (for example,
  551.        passwords with accented European characters)  may  not  be
  552.        portable  across  systems  and/or  other  archivers.  This
  553.        problem stems from the use of  multiple  encoding  methods
  554.        for  such  characters,  including Latin-1 (ISO 8859-1) and
  555.        OEM code page 850.  DOS PKZIP  2.04g  uses  the  OEM  code
  556.        page;  Windows  PKZIP  2.50 uses Latin-1 (and is therefore
  557.        incompatible with DOS PKZIP); Info-ZIP uses the  OEM  code
  558.        page  on DOS, OS/2 and Win3.x ports but Latin-1 everywhere
  559.        else; and Nico Mak's WinZip 6.x does not allow 8-bit pass-
  560.        words at all.  UnZip 5.3 attempts to use the default char-
  561.        acter set first (e.g., Latin-1), followed by the alternate
  562.        one  (e.g.,  OEM  code page) to test passwords.  On EBCDIC
  563.        systems, if both of these fail, EBCDIC  encoding  will  be
  564.        tested  as  a  last  resort.   (Since  there  are no known
  565.        archivers that encrypt using EBCDIC  encoding,  EBCDIC  is
  566.        not  tested  on non-EBCDIC systems.)  ISO character encod-
  567.        ings other than Latin-1 are not supported.
  568.  
  569. EXAMPLES
  570.        To use unzip to extract all members of  the  archive  let-
  571.        ters.zip  into  the  current  directory and subdirectories
  572.        below it, creating any subdirectories as necessary:
  573.  
  574.            unzip letters
  575.  
  576.        To extract all members of  letters.zip  into  the  current
  577.        directory only:
  578.  
  579.            unzip -j letters
  580.  
  581.        To test letters.zip, printing only a summary message indi-
  582.        cating whether the archive is OK or not:
  583.  
  584.            unzip -tq letters
  585.  
  586. Info-ZIP               22 April 1997 (v5.3)                    10
  587.  
  588. UNZIP(1L)                                               UNZIP(1L)
  589.  
  590.        To test all zipfiles in the  current  directory,  printing
  591.        only the summaries:
  592.  
  593.            unzip -tq \*.zip
  594.  
  595.        (The backslash before the asterisk is only required if the
  596.        shell expands wildcards, as in Unix; double  quotes  could
  597.        have   been  used  instead,  as  in  the  source  examples
  598.        below.)  To extract to standard output all members of let-
  599.        ters.zip  whose  names end in .tex, auto-converting to the
  600.        local end-of-line convention and piping  the  output  into
  601.        more(1):
  602.  
  603.            unzip -ca letters \*.tex | more
  604.  
  605.        To  extract  the binary file paper1.dvi to standard output
  606.        and pipe it to a printing program:
  607.  
  608.            unzip -p articles paper1.dvi | dvips
  609.  
  610.        To extract all FORTRAN and C source files--*.f, *.c,  *.h,
  611.        and Makefile--into the /tmp directory:
  612.  
  613.            unzip source.zip "*.[fch]" Makefile -d /tmp
  614.  
  615.        (the  double quotes are necessary only in Unix and only if
  616.        globbing is turned on).  To  extract  all  FORTRAN  and  C
  617.        source  files, regardless of case (e.g., both *.c and *.C,
  618.        and any makefile, Makefile, MAKEFILE or similar):
  619.  
  620.            unzip -C source.zip "*.[fch]" makefile -d /tmp
  621.  
  622.        To extract any such files but convert any uppercase MS-DOS
  623.        or  VMS names to lowercase and convert the line-endings of
  624.        all of the files to the local standard (without respect to
  625.        any files that might be marked ``binary''):
  626.  
  627.            unzip -aaCL source.zip "*.[fch]" makefile -d /tmp
  628.  
  629.        To extract only newer versions of the files already in the
  630.        current directory, without querying (NOTE:  be careful  of
  631.        unzipping   in   one   timezone   a   zipfile  created  in
  632.        another--ZIP archives other than those created by Zip  2.1
  633.        or  later contain no timezone information, and a ``newer''
  634.        file from an eastern timezone may, in fact, be older):
  635.  
  636.            unzip -fo sources
  637.  
  638.        To extract newer versions of the files already in the cur-
  639.        rent  directory  and to create any files not already there
  640.        (same caveat as previous example):
  641.  
  642.            unzip -uo sources
  643.  
  644. Info-ZIP               22 April 1997 (v5.3)                    11
  645.  
  646. UNZIP(1L)                                               UNZIP(1L)
  647.  
  648.        To display a diagnostic screen  showing  which  unzip  and
  649.        zipinfo  options  are  stored  in  environment  variables,
  650.        whether decryption support was compiled in,  the  compiler
  651.        with which unzip was compiled, etc.:
  652.  
  653.            unzip -v
  654.  
  655.        In the last five examples, assume that UNZIP or UNZIP_OPTS
  656.        is set to -q.  To do a singly quiet listing:
  657.  
  658.            unzip -l file.zip
  659.  
  660.        To do a doubly quiet listing:
  661.  
  662.            unzip -ql file.zip
  663.  
  664.        (Note that the ``.zip'' is generally not  necessary.)   To
  665.        do a standard listing:
  666.  
  667.            unzip --ql file.zip
  668.        or
  669.            unzip -l-q file.zip
  670.        or
  671.            unzip -l--q file.zip       (extra minuses don't hurt)
  672.  
  673. TIPS
  674.        The  current  maintainer, being a lazy sort, finds it very
  675.        useful to define a pair of aliases:  tt for ``unzip  -tq''
  676.        and  ii  for  ``unzip -Z'' (or ``zipinfo'').  One may then
  677.        simply type ``tt zipfile'' to test an  archive,  something
  678.        that  is  worth  making a habit of doing.  With luck unzip
  679.        will report ``No errors detected  in  compressed  data  of
  680.        zipfile.zip,''  after  which  one  may  breathe  a sigh of
  681.        relief.
  682.  
  683.        The maintainer also finds it useful to set the UNZIP envi-
  684.        ronment  variable  to ``-aL'' and is tempted to add ``-C''
  685.        as well.  His ZIPINFO variable is set to ``-z''.
  686.  
  687. DIAGNOSTICS
  688.        The exit status (or error  level)  approximates  the  exit
  689.        codes defined by PKWARE and takes on the following values,
  690.        except under VMS:
  691.  
  692.               0      normal; no errors or warnings detected.
  693.  
  694.               1      one or more warning errors were encountered,
  695.                      but  processing  completed successfully any-
  696.                      way.  This includes zipfiles  where  one  or
  697.                      more  files  was  skipped due to unsupported
  698.                      compression method  or  encryption  with  an
  699.                      unknown password.
  700.  
  701.               2      a  generic  error  in the zipfile format was
  702.  
  703. Info-ZIP               22 April 1997 (v5.3)                    12
  704.  
  705. UNZIP(1L)                                               UNZIP(1L)
  706.  
  707.                      detected.   Processing  may  have  completed
  708.                      successfully  anyway;  some  broken zipfiles
  709.                      created by other archivers have simple work-
  710.                      arounds.
  711.  
  712.               3      a  severe  error  in  the zipfile format was
  713.                      detected.  Processing probably failed  imme-
  714.                      diately.
  715.  
  716.               4      unzip  was unable to allocate memory for one
  717.                      or more buffers during  program  initializa-
  718.                      tion.
  719.  
  720.               5      unzip  was  unable  to  allocate  memory  or
  721.                      unable to obtain a tty to read  the  decryp-
  722.                      tion password(s).
  723.  
  724.               6      unzip  was  unable to allocate memory during
  725.                      decompression to disk.
  726.  
  727.               7      unzip was unable to allocate  memory  during
  728.                      in-memory decompression.
  729.  
  730.               8      [currently not used]
  731.  
  732.               9      the specified zipfiles were not found.
  733.  
  734.               10     invalid  options  were specified on the com-
  735.                      mand line.
  736.  
  737.               11     no matching files were found.
  738.  
  739.               50     the disk is (or was) full during extraction.
  740.  
  741.               51     the  end  of the ZIP archive was encountered
  742.                      prematurely.
  743.  
  744.               80     the user aborted unzip prematurely with con-
  745.                      trol-C (or similar)
  746.  
  747.               81     no  files were found due to unsupported com-
  748.                      pression methods or unsupported  decryption.
  749.                      (If even one additional file is successfully
  750.                      processed, however, the exit status is 1.)
  751.  
  752.               82     no files were found due  to  bad  decryption
  753.                      password(s).   This  is also the exit status
  754.                      if no files were found due to a  combination
  755.                      of  unsupported  compression  and  bad pass-
  756.                      words.  As in the previous case, however,  a
  757.                      single  successful  file  will  result in an
  758.                      exit status of 1 instead.)
  759.  
  760.        VMS interprets standard Unix  (or  PC)  return  values  as
  761.  
  762. Info-ZIP               22 April 1997 (v5.3)                    13
  763.  
  764. UNZIP(1L)                                               UNZIP(1L)
  765.  
  766.        other,  scarier-looking things, so unzip instead maps them
  767.        into VMS-style status codes.  The current  mapping  is  as
  768.        follows:    1  (success)  for  normal exit, 0x7fff0001 for
  769.        warning    errors,    and    (0x7fff000?     +     16*nor-
  770.        mal_unzip_exit_status) for all other errors, where the `?'
  771.        is 2 (error) for unzip values 2, 9-11  and  80-82,  and  4
  772.        (fatal  error)  for  the remaining ones (3-8, 50, 51).  In
  773.        addition, there is a compilation  option  to  expand  upon
  774.        this  behavior:  defining RETURN_CODES results in a human-
  775.        readable explanation of what the error status means.
  776.  
  777. BUGS
  778.        Multi-part archives are not yet supported, except in  con-
  779.        junction  with  zip.   (All  parts  must  be  concatenated
  780.        together in order, and then ``zip -F'' must  be  performed
  781.        on the concatenated archive in order to ``fix'' it.)  This
  782.        will definitely be corrected in the next major release.
  783.  
  784.        Archives read from standard input are not  yet  supported,
  785.        except  with funzip (and then only the first member of the
  786.        archive can be extracted).
  787.  
  788.        Archives encrypted with 8-bit passwords  (e.g.,  passwords
  789.        with  accented  European  characters)  may not be portable
  790.        across systems and/or other archivers.  See the discussion
  791.        in DECRYPTION above.
  792.  
  793.        unzip's  -M  (``more'') option is overly simplistic in its
  794.        handling of screen output; as noted  above,  it  fails  to
  795.        detect  the  wrapping  of long lines and may thereby cause
  796.        lines at the top of the screen to be scrolled  off  before
  797.        being read.  unzip should detect and treat each occurrence
  798.        of  line-wrap  as  one  additional  line  printed.    This
  799.        requires  knowledge  of  the screen's width as well as its
  800.        height.  In addition, unzip should detect the true  screen
  801.        geometry on all systems.
  802.  
  803.        Dates, times and permissions of stored directories are not
  804.        restored except under Unix.
  805.  
  806.        [MS-DOS] When extracting or testing files from an  archive
  807.        on  a defective floppy diskette, if the ``Fail'' option is
  808.        chosen from DOS's ``Abort, Retry, Fail?''  message,  older
  809.        versions of unzip may hang the system, requiring a reboot.
  810.        This problem appears to be fixed, but control-C  (or  con-
  811.        trol-Break) can still be used to terminate unzip.
  812.  
  813.        Under  DEC Ultrix, unzip would sometimes fail on long zip-
  814.        files (bad CRC, not always reproducible).  This was appar-
  815.        ently  due  either  to a hardware bug (cache memory) or an
  816.        operating system bug (improper handling of page  faults?).
  817.        Since  Ultrix  has been abandoned in favor of Digital Unix
  818.        (OSF/1), this may not be an issue anymore.
  819.  
  820. Info-ZIP               22 April 1997 (v5.3)                    14
  821.  
  822. UNZIP(1L)                                               UNZIP(1L)
  823.  
  824.        [Unix] Unix special files  such  as  FIFO  buffers  (named
  825.        pipes),  block  devices  and  character  devices  are  not
  826.        restored even if they are somehow represented in the  zip-
  827.        file,  nor  are hard-linked files relinked.  Basically the
  828.        only file types  restored  by  unzip  are  regular  files,
  829.        directories and symbolic (soft) links.
  830.  
  831.        [OS/2]  Extended  attributes  for existing directories are
  832.        only updated if  the  -o  (``overwrite  all'')  option  is
  833.        given.   This  is  a  limitation  of the operating system;
  834.        because directories only have a creation  time  associated
  835.        with  them,  unzip  has  no  way  to determine whether the
  836.        stored attributes are newer or older than those  on  disk.
  837.        In practice this may mean a two-pass approach is required:
  838.        first unpack the archive normally (with or without  fresh-
  839.        ening/updating  existing  files),  then overwrite just the
  840.        directory entries (e.g., ``unzip -o foo */'').
  841.  
  842.        [VMS] When  extracting  to  another  directory,  only  the
  843.        [.foo]  syntax  is  accepted for the -d option; the simple
  844.        Unix foo syntax is silently ignored (as is the less common
  845.        VMS foo.dir syntax).
  846.  
  847.        [VMS]  When  the  file  being  extracted  already  exists,
  848.        unzip's query only allows skipping, overwriting or  renam-
  849.        ing;  there should additionally be a choice for creating a
  850.        new version of  the  file.   In  fact,  the  ``overwrite''
  851.        choice  does  create a new version; the old version is not
  852.        overwritten or deleted.
  853.  
  854. SEE ALSO
  855.        funzip(1L),  zip(1L),  zipcloak(1L),   zipgrep(1L),   zip-
  856.        info(1L), zipnote(1L), zipsplit(1L)
  857.  
  858. URL
  859.        The     Info-ZIP     home    page    is    currently    at
  860.        http://www.cdrom.com/pub/infozip/ .
  861.  
  862. AUTHORS
  863.        The primary Info-ZIP authors (current semi-active  members
  864.        of  the  Zip-Bugs  workgroup)  are:   Greg  ``Cave  Newt''
  865.        Roelofs (UnZip); Onno  van  der  Linden  (Zip);  Jean-loup
  866.        Gailly  (compression); Mark Adler (decompression, fUnZip);
  867.        Christian Spieler (VMS, MS-DOS,  Windows  95,  NT,  shared
  868.        code, general Zip and UnZip integration and optimization);
  869.        Mike White (Windows GUI, Windows  DLLs);  Kai  Uwe  Rommel
  870.        (OS/2);  Paul  Kienitz (Amiga, Windows 95); Chris Herborth
  871.        (BeOS, QNX, Atari); Jonathan Hudson (SMS/QDOS); Karl Davis
  872.        and  Sergio  Monesi (Acorn RISC OS); Harald Denker (Atari,
  873.        MVS); John Bush (Solaris, Amiga);  Hunter  Goatley  (VMS);
  874.        Steve Salisbury (Windows 95, NT); Steve Miller (Windows CE
  875.        GUI), Johnny Lee (MS-DOS,  Windows  95,  NT);  and  Robert
  876.        Heath  (Windows  GUI).   The  author of the original unzip
  877.        code upon which Info-ZIP's was based is Samuel  H.  Smith;
  878.  
  879. Info-ZIP               22 April 1997 (v5.3)                    15
  880.  
  881. UNZIP(1L)                                               UNZIP(1L)
  882.  
  883.        Carl  Mascott  did  the  first  Unix  port;  and  David P.
  884.        Kirschbaum organized and led Info-ZIP in  its  early  days
  885.        with  Keith  Petersen hosting the original mailing list at
  886.        WSMR-SimTel20.  The full list of contributors to UnZip has
  887.        grown  quite  large;  please refer to the CONTRIBS file in
  888.        the UnZip source distribution for  a  relatively  complete
  889.        version.
  890.  
  891. VERSIONS
  892.        v1.2   15 Mar 89   Samuel H. Smith
  893.        v2.0    9 Sep 89   Samuel H. Smith
  894.        v2.x   fall 1989   many Usenet contributors
  895.        v3.0    1 May 90   Info-ZIP (DPK, consolidator)
  896.        v3.1   15 Aug 90   Info-ZIP (DPK, consolidator)
  897.        v4.0    1 Dec 90   Info-ZIP (GRR, maintainer)
  898.        v4.1   12 May 91   Info-ZIP
  899.        v4.2   20 Mar 92   Info-ZIP (Zip-Bugs subgroup, GRR)
  900.        v5.0   21 Aug 92   Info-ZIP (Zip-Bugs subgroup, GRR)
  901.        v5.01  15 Jan 93   Info-ZIP (Zip-Bugs subgroup, GRR)
  902.        v5.1    7 Feb 94   Info-ZIP (Zip-Bugs subgroup, GRR)
  903.        v5.11   2 Aug 94   Info-ZIP (Zip-Bugs subgroup, GRR)
  904.        v5.12  28 Aug 94   Info-ZIP (Zip-Bugs subgroup, GRR)
  905.        v5.2   30 Apr 96   Info-ZIP (Zip-Bugs subgroup, GRR)
  906.        v5.3   22 Apr 97   Info-ZIP (Zip-Bugs subgroup, GRR)
  907.  
  908. Info-ZIP               22 April 1997 (v5.3)                    16
  909.  
  910.